﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CROSLAND.BL.BE;
using CROSLAND.DL.DALCF;

namespace CROSLAND.BL.BC
{
    public class MaterialBC
    {
        #region Singleton
        private MaterialBC() { }
        private static MaterialBC _instance = null;
        public static MaterialBC Instance
        {
            get { return (_instance == null) ? _instance = new MaterialBC() : _instance; }
        }
        #endregion

        public MaterialBE leerMaterial(string pCodigo, string pOrgVtas, string pCanalDist, string sector, string ofVtas, string usuarioWeb, string centro, string almacen)
        {
            List<MaterialBE> lstM = new List<MaterialBE>();
            MaterialBE objM = new MaterialBE();
            lstM = DaoFactory.MaterialDALC.buscarMateriales(pCodigo, "", "", pOrgVtas, pCanalDist, ofVtas, usuarioWeb, sector, centro, almacen); //WEBDIST
            if (lstM.Count > 0)
            {
                objM = lstM[0];
            }
            else
            {
                objM = null;
            }
            return objM;
        }

        public List<MaterialBE> buscarMateriales(string pDesMat, string pJerMat, string pOrgVtas, string pCanalDist, string ofVtas,string usuarioWeb, string sector, string centro, string almacen)
        {
            return DaoFactory.MaterialDALC.buscarMateriales("", pDesMat, pJerMat, pOrgVtas, pCanalDist, ofVtas, usuarioWeb, sector, centro, almacen);
        }

        public List<MaterialBE> buscarMaterialesReemplazo(string pCodMat)
        {
            return DaoFactory.MaterialDALC.buscarMaterialesReemplazo(pCodMat);
        }

        public List<GenericBE> caracteristicaMat(string pCodMat, string pLote)
        {
            return DaoFactory.MaterialDALC.caracteristicaMat(pCodMat, pLote);
        }
    }
}